<div class="home_box" style="padding: 10px;">
    <div style="display: none">
        <input type="hidden" id="operationTime" value="">
    </div>
    <div class="chargeBtn" style="display: flex;">
        <button type="button" id="zdjl" class="btn">账单记录</button>
        <button style="background: white;" type="button" class="btn">支付记录</button>
        <button style="background: white;" type="button" class="btn">欠款</button>
    </div>
    <div class="chargeContent">
        <!-- 账单记录 -->
        <div>
            <div style="display: flex;padding: 10px 0">
                <div style="flex: 1">
                    <span>已收费</span>
                    <span><label><input style="vertical-align: sub;" class="dealCheck" id="settleCheck"
                                        checked="checked" type="checkbox">结清</label></span>
                    <span><label><input style="vertical-align: sub;" class="dealCheck" id="refundCheck"
                                        checked="checked" type="checkbox">退款</label></span>
                    <span><label><input style="vertical-align: sub;" class="dealCheck" id="arrearsCheck"
                                        checked="checked" type="checkbox">欠费</label></span>
                    <span><label><input style="vertical-align: sub;" class="dealCheck" id="deductionCheck"
                                        checked="checked" type="checkbox">抵扣</label></span>
                    <span style="margin-left: 10px;font-weight: bold;">实收总额 <span style="font-size: 16px;">${totalPayDealActualPay}</span></span>
                    <span style="margin-left: 10px;font-weight: bold;">欠费总额 <span style="font-size: 16px;color: red">${totalPayDealArrears}</span></span>
                </div>
                <div class="chargeBtn" style="text-align: right">
                </div>
            </div>
            <div style="border-bottom: 2px solid #ff7e00;border-top: 2px solid #ff7e00;">
                <div style="display: flex;padding: 6px 0;border-bottom: 1px solid #ff7e00;color: #666a73;text-align: center">
                    <div style="flex: 1;">展开</div>
                    <div style="flex: 1;">操作诊所</div>
                    <div style="flex: 1;">单据号</div>
                    <div style="flex: 2;">首次收费时间</div>
                    <div style="flex: 1;">账单状态</div>
                    <div style="flex: 1;">医生</div>
                    <div style="flex: 1;">护士</div>
                    <div style="flex: 1;">TC</div>
                    <div style="flex: 1;">应收</div>
                    <div style="flex: 1;">实收</div>
                    <div style="flex: 1;">优惠抵扣</div>
                    <div style="flex: 1;">欠费汇总</div>
                    <div style="flex: 2;">备注</div>
                    <div style="flex: 2.5;">操作</div>
                </div>
                <div id="orderhtml">
                    @for(custDeal in custDealList){
                    <div class="order">
                        <div style="display: flex;text-align: center;border-bottom: 1px solid #DDDDDD;padding: 5px 0">
                            <div style="flex: 1;" class="showDetail">
                                <span class="glyphicon glyphicon-collapse-down"></span>
                                <span class="glyphicon glyphicon-collapse-up" style="display: none"></span>
                            </div>
                            <div style="flex: 1;">${custDeal.outpatientName}</div>
                            <div style="flex: 1;">${custDeal.documentNumber}</div>
                            <div style="flex: 2;" class="beyond" title="${custDeal.operationTime}">${custDeal.operationTime}</div>
                            <div style="flex: 1;">${custDeal.dealStatus}</div>
                            <div style="flex: 1;" class="beyond" title="${custDeal.doctor}">${custDeal.doctor}</div>
                            <div style="flex: 1">${custDeal.nurse}</div>
                            <div style="flex: 1;">${custDeal.tcName}</div>
                            <div style="flex: 1;">${custDeal.foldingPay}</div>
                            <div style="flex: 1;">${custDeal.serviceActualPay+custDeal.depositAmount}</div>
                            <div style="flex: 1;">${custDeal.deductionAmount}</div>
                            <div class="dealArrears" style="flex: 1;">${custDeal.arrears}</div>
                            <div style="flex: 2;" class="beyond" title="${custDeal.remarks}">${custDeal.remarks}</div>
                            <div class="dealDeductionAmount" style="display: none">${custDeal.deductionAmount}</div>
                            <div style="flex: 2.5;">
                                 <span><a href="javascript:;" onclick="openingDetails('${custDeal.operationTime}','${custDeal.outpatientName}')">首次开单详情</a></span>
                                <span><a href="javascript:;" onclick="detailsPrint('${custDeal.operationTime}','${custDeal.outpatientName}')">打印</a></span>
                            </div>
                        </div>
                        <div style="padding: 15px 20px;overflow: hidden;display: none">
                            <div class="dealInfoList"
                                 style="box-shadow: 0 0 8px #cccccc;border-radius: 6px;overflow: hidden;">
                                <div style="display: flex;padding: 4px 0;background: #fec182;color: #666a73;text-align: center">
                                    <div style="flex: 1;">操作诊所</div>
                                    <div style="flex: 2;">交易时间</div>
                                    <div style="flex: 1;">交易类型</div>
                                    <div style="flex: 1;">交易状态</div>
                                    <div style="flex: 1;">收费人</div>
                                    <div style="flex: 1;">医生</div>
                                    <div style="flex: 1;">护士</div>
                                    <div style="flex: 1;">实收</div>
                                    <div style="flex: 1;">优惠抵扣</div>
                                    <div style="flex: 1.5;">收费方式</div>
                                    <div style="flex: 2;">备注</div>
                                    <div style="flex: 2;">操作</div>
                                </div>
                                @for(dealInfo in custDeal.dealList){
                                <div class="openOrder"
                                     style="display: flex;padding: 7px 0;border-top: 1px solid #eeeeee;text-align: center;">
                                    <div style="flex: 1;">${dealInfo.outpatientName}</div>
                                    <div style="flex: 2;">${dealInfo.getTime}</div>
                                    @if(dealInfo.isDo == 1){
                                    <div class="dealType" style="flex: 1;">储值划扣</div>
                                    @}
                                    @if(dealInfo.isDo == 2){
                                    <div class="dealType" style="flex: 1;">继续做</div>
                                    @}
                                    @if(dealInfo.isDo == 3){
                                    <div class="dealType" style="flex: 1;">还欠款</div>
                                    @}
                                    @if(dealInfo.isDo == 4){
                                    <div class="dealType" style="flex: 1;">退款</div>
                                    @}
                                    @if(dealInfo.isDo == 5){
                                    <div class="dealType" style="flex: 1;">消费</div>
                                    @}
                                    @if(dealInfo.isDo == 6){
                                    <div class="dealType" style="flex: 1;">作废</div>
                                    @}
                                    @if(dealInfo.dealStatus == '已开单'){
                                    <div style="flex: 1;">${dealInfo.dealStatus}</div>
                                    @}
                                    @if(dealInfo.dealStatus == '已结账'){
                                    <div style="flex: 1;">已结账</div>
                                    @}
                                    <div style="flex: 1;">${dealInfo.rechargePeople}</div>
                                    <div style="flex: 1;">${dealInfo.doctor}</div>
                                    <div style="flex: 1">${dealInfo.nurse}</div>
                                    <div style="flex: 1;" class="beyond" title="${dealInfo.serviceActualPay}元">
                                        ${dealInfo.serviceActualPay}元
                                    </div>
                                    <div style="flex: 1;" class="beyond" title="${dealInfo.deductionAmount}">
                                        ${dealInfo.deductionAmount}
                                    </div>
                                    <div style="flex: 1.5;" class="beyond" title="(${dealInfo.checkoutMethod})">
                                        (${dealInfo.checkoutMethod})
                                    </div>
                                    <div style="flex: 2;" class="beyond" title="${dealInfo.remarks}">
                                        ${dealInfo.remarks}
                                    </div>
                                    <div style="flex: 2.5">
                                        <a onclick="openingDetails('${dealInfo.operationTime}','${dealInfo.outpatientName}')">详情</a>
                                        <a onclick="printingDeal('${dealInfo.operationTime}','${dealInfo.outpatientName}','${dealInfo.getTime}','${reservationsId}')">打印</a>
                                    </div>
                                </div>
                                @}
                            </div>
                        </div>
                    </div>
                    @}
                </div>
            </div>
        </div>
        <!-- 支付记录 -->
        <div style="display: none">
            <div style="padding: 10px 0;font-weight: bolder;">
                <span>支付记录</span>
                <span>实收总额 <span style="font-size: 16px;">${totalPayDealActualPay}</span></span>
                <span>欠费总额 <span style="font-size: 16px;color: red">${totalPayDealArrears}</span></span>
            </div>
            <div style="border-bottom: 2px solid #ff7e00">
                <div style="display: flex;border-bottom: 1px solid #ff7e00;border-top: 2px solid #ff7e00;padding: 5px;text-align: center;">
                    <div style="flex: 1">操作诊所</div>
                    <div style="flex: 2">交易时间</div>
                    <div style="flex: 1">交易类型</div>
                    <div style="flex: 1">交易状态</div>
                    <div style="flex: 1">收费人</div>
                    <div style="flex: 1">TC</div>
                    <div style="flex: 1">财务应收</div>
                    <div style="flex: 1">应收</div>
                    <div style="flex: 1">实收</div>
                    <div style="flex: 1">优惠抵扣</div>
                    <div style="flex: 1">欠费变动</div>
                    <div style="flex: 1">备注</div>
                </div>
                @for(payDeal in payDealList){
                <div style="display: flex;border-bottom: 1px solid #DDDDDD;padding: 5px;text-align: center;">
                    @if(payDeal.isDo == 3){
                    <div style="flex: 1">${payDeal.outpatientName}</div>
                    <div style="flex: 2">${payDeal.getTime}</div>
                    <div style="flex: 1;">还欠款</div>
                    <div style="flex: 1">${payDeal.dealStatus}</div>
                    <div style="flex: 1">${payDeal.rechargePeople}</div>
                    <div style="flex: 1">${payDeal.tcName}</div>
                    <div style="flex: 1">${payDeal.foldingPay-payDeal.deductionAmount}</div>
                    <div style="flex: 1">0.0</div>
                    <div style="flex: 1">${payDeal.serviceActualPay}</div>
                    <div style="flex: 1">${payDeal.deductionAmount}</div>
                    <div style="flex: 1">${payDeal.arrears}</div>
                    <div style="flex: 1">${payDeal.remarks}</div>
                    @}
                    @if(payDeal.isDo == 4){
                    <div style="flex: 1">${payDeal.outpatientName}</div>
                    <div style="flex: 2">${payDeal.getTime}</div>
                    <div style="flex: 1;">退款</div>
                    <div style="flex: 1">${payDeal.dealStatus}</div>
                    <div style="flex: 1">${payDeal.rechargePeople}</div>
                    <div style="flex: 1">${payDeal.tcName}</div>
                    <div style="flex: 1">${payDeal.serviceActualPay+payDeal.arrears}</div>
                    <div style="flex: 1">${payDeal.tkfoldingPay}</div>
                    <div style="flex: 1">${payDeal.serviceActualPay}</div>
                    <div style="flex: 1">${payDeal.deductionAmount}</div>
                    <div style="flex: 1">${payDeal.arrears}</div>
                    <div style="flex: 1">${payDeal.remarks}</div>
                    @}
                    @if(payDeal.isDo == 5){
                    <div style="flex: 1">${payDeal.outpatientName}</div>
                    <div style="flex: 2">${payDeal.getTime}</div>
                    <div style="flex: 1;">消费</div>
                    <div style="flex: 1">${payDeal.dealStatus}</div>
                    <div style="flex: 1">${payDeal.rechargePeople}</div>
                    <div style="flex: 1">${payDeal.tcName}</div>
                    <div style="flex: 1">${payDeal.foldingPay-payDeal.deductionAmount}</div>
                    <div style="flex: 1">${payDeal.foldingPay}</div>
                    <div style="flex: 1">${payDeal.serviceActualPay+payDeal.depositAmount}</div>
                    <div style="flex: 1">${payDeal.deductionAmount}</div>
                    <div style="flex: 1">${payDeal.arrears}</div>
                    <div style="flex: 1">${payDeal.remarks}</div>
                    @}
                    @if(payDeal.isDo == 6){
                    <div style="flex: 1">${payDeal.outpatientName}</div>
                    <div style="flex: 2">${payDeal.getTime}</div>
                    <div style="flex: 1;">作废</div>
                    <div style="flex: 1">${payDeal.dealStatus}</div>
                    <div style="flex: 1">${payDeal.rechargePeople}</div>
                    <div style="flex: 1">${payDeal.tcName}</div>
                    <div style="flex: 1">${payDeal.foldingPay-payDeal.deductionAmount}</div>
                    <div style="flex: 1">${payDeal.foldingPay}</div>
                    <div style="flex: 1">${payDeal.serviceActualPay}</div>
                    <div style="flex: 1">${payDeal.deductionAmount}</div>
                    <div style="flex: 1">${payDeal.arrears}</div>
                    <div style="flex: 1">${payDeal.remarks}</div>
                    @}
                </div>
                @}
            </div>
        </div>
        <!-- 欠费 -->
        <div style="display: none">
            <div style="border-bottom: 2px solid #FF7E00;margin-top: 10px;">
                <div id="arrearsDeal2">
                    <div style="display: flex;border-bottom: 1px solid #FF7E00;border-top: 2px solid #FF7E00;padding: 5px;text-align: center;">
                        <div style="flex: 0.4"></div>
                        <div style="flex: 1">诊所</div>
                        <div style="flex: 1.2">首次收费时间</div>
                        <div style="flex: 2">欠费项目</div>
                        <div style="flex: 1">tc</div>
                        <div style="flex: 1">医生</div>
                        <div style="flex: 1;">护士</div>
                        <div style="flex: 1">应收</div>
                        <div style="flex: 1">实收</div>
                        <div style="flex: 1">优惠抵扣</div>
                        <div style="flex: 1">欠费</div>
                        <div style="flex: 1">备注</div>
                    </div>
                    @for(arrearsDeal in arrearsDealList){
                    <div class="arrearsDeal"
                         style="display: flex;border-bottom: 1px solid #DDDDDD;padding: 5px;text-align: center;">
                        <div style="flex: 0.4"><input onclick="chooseArrearsDeal(this)" class="id"
                                                      value="${arrearsDeal.operationTime}" type="radio"
                                                      name="checkedres"></div>
                        <div class="arrearsOutpatientName" style="flex: 1">${arrearsDeal.outpatientName}</div>
                        <div style="flex: 1.3" class="beyond" title="${arrearsDeal.operationTime}">
                            ${arrearsDeal.operationTime}
                        </div>
                        <div style="flex: 2" class="beyond" title="${arrearsDeal.payServiceName}">
                            ${arrearsDeal.payServiceName}
                        </div>
                        <div style="flex: 1" class="atcName">${arrearsDeal.tcName}</div>
                        <div style="flex: 1">${arrearsDeal.doctor}</div>
                        <div style="flex: 1">${arrearsDeal.nurse}</div>
                        <div style="flex: 1">${arrearsDeal.foldingPay}</div>
                        <div style="flex: 1">${arrearsDeal.serviceActualPay}</div>
                        <div style="flex: 1">${arrearsDeal.deductionAmount}</div>
                        <div style="flex: 1" class="arrears">${arrearsDeal.arrears}</div>
                        <div style="flex: 1" class="beyond" title="${arrearsDeal.remarks}">${arrearsDeal.remarks}</div>
                    </div>
                    @}
                </div>
                <div style="text-align: right;padding: 10px 0;color: #FF7E00;font-size: 14px;font-weight: bolder;border-top: 1px solid #FF7E00">
                    <span>总计应收</span>
                    <span id="totalArrearsAmount">${totalArrearsAmount}</span>
                </div>
            </div>
            <div>
                <div style="background: #f4f4f4;padding: 7px 15px;display: flex;border-radius: 3px;overflow: hidden;margin-top: 10px;">
                    <div style="display: flex;background: white;padding: 4px 12px;border-radius: 3px;font-weight: bolder;">
                        <div><span>总欠款：</span><span id="chooseDealArrears" style="font-size: 16px;color: red;">0.00</span></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="${ctxPath}/static/modular/marketing/reservations/reservations_chargeDetails.js?v=20200628"></script>